/**
 * Copyright (c) Huawei Technologies Co., Ltd. 1987-2021. All rights reserved.
*/

package com.gitee.fufu669.utils;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author wangfupeng
 */
public class CacheResponseUtil {

    /**
     * TODO
    */
    public static final Logger logger = LoggerFactory.getLogger(CacheResponseUtil.class);

    /**
     * TODO
    */
    public static void writeResponse(HttpServletResponse response, String result) {
        // 尝试下面的代码
        try {
            //直接将完整的表单html输出到页面
            response.setContentType("text/html;charset=utf-8");
            // 写入
            response.getWriter().write(result);
            // 清空内存的缓冲区数据
            response.getWriter().flush();
        // 捕捉异常
        } catch (IOException e) {
            // 打印异常
            e.printStackTrace();
        }
    }

}
